package ssqstone.xueba;

import java.util.HashMap;
import java.util.Map;

public class MapWithDefaultValue<K, V> extends HashMap<K, V>
{
    private static final long serialVersionUID = 5977440282118337837L;
    
    public MapWithDefaultValue()
    {
        super();
    }
    
    public MapWithDefaultValue(Map<K, V> all)
    {
        super(all);
    }
    
    public V get(K key, V defaultVal)
    {
        V val = super.get(key);
        return val == null ? defaultVal : val;
    }
}
